/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Bai2;

import java.awt.Container;
import java.awt.EventQueue;

import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import javax.swing.ButtonGroup;

import javax.swing.JButton;
import javax.swing.JEditorPane;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPasswordField;
import javax.swing.JRadioButton;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.JTextArea;

import javax.swing.JTextField;


/**
 *
 * @author MS
 */
public class MyFileChooser {
    public static void main(String args[])
    {
       Runnable runner = new Runnable() {
			public void run() {
				JFrame frame = new JFrame("Duyet va lay duong dan cua File/Directory");   //Tao Frame co ten Hello Swing
				//frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                                frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);   //Thoat  jFrame
                                //frame.setLayout(new FlowLayout());
                               // frame.setLayout(new HorizBagLayout());
                                frame.setLayout(new GridBagLayout());
				Container contentPane =frame.getContentPane();  //lay phan mau xam trong jframe
                                GridBagConstraints c=new GridBagConstraints();  //Tao Layout cho phep dat cac cong cu theo toa do
                                c.gridx=0;
                                c.gridy=0;

                                JLabel lbl1=new JLabel("Nhap duong dan cua File:");
                                c.gridx=0;
                                c.gridy=0;
                                contentPane.add(lbl1);

                                JTextField txt1=new JTextField(20);
                                txt1.setName("Directory");
                                
                                c.gridx=1;
                                c.gridy=0;
                                contentPane.add(txt1);

                                JButton btn1=new JButton("Browse");                                
                                c.gridx=2;
                                c.gridy=0;
                                contentPane.add(btn1);
                  
                                JFCListener JFC=new JFCListener();
                                btn1.addActionListener(JFC);

				frame.setSize(500,100);
				frame.setVisible(true);




			}
		};
		EventQueue.invokeLater(runner);
    }

}
